
from django.contrib import admin
from django.urls import path, include
from web.views import account, home, project, statistics, wiki, settings, issues,dashboard
from web.views import file

urlpatterns = [

    path('registers/', account.register, name="web_register"),
    path('send/sms', account.send_sms, name="web_send_sms"),
    path('login/sms', account.login_sms, name="web_login_sms"),
    path('login/', account.login, name="web_login"),
    path('image/code', account.image_code, name="web_image_code"),
    path('index', home.index, name="web_index"),
    path('loginout', account.loginout, name="web_loginout"),

    path('price/', home.price, name="web_price"),
    path('payment/<int:policy_id>/', home.payment, name="web_payment"),
    path('pay/', home.pay, name="web_pay"),
    path('pay/notify/', home.pay_notify, name="web_pay_notify"),


    # 项目列表
    path('project/list', project.project_list, name="web_project_list"),
    # /project/star/my/1
    # /project/star/join/1
    path('project/star/(?P<project_type>\w+)/(?P<project_id>\d+)/', project.project_star, name="web_project_star"),
    path('project/unstar/(?P<project_type>\w+)/(?P<project_id>\d+)/', project.project_unstar,
         name="web_project_unstar"),

    # 项目管理
    # 做一个路由的分发
    path('manage/<int:project_id>/', include([
        path('dashboard/', dashboard.dashboard, name="web_dashboard"),
        path('dashboard/issues/chart/', dashboard.issues_chart, name="web_issues_chart"),



        path('statistics/', statistics.statistics, name="web_statistics"),
        path('statistics/priority/', statistics.statistics_priority, name="web_statistics_priority"),
        path('statistics/project_user/', statistics.statistics_project_user, name="web_statistics_project_user"),



        path('file/', file.file, name="web_file"),
        path('file/delete/', file.file_delete, name="web_file_delete"),
        path('cos/credentials/', file.cos_credentials, name="web_cos_credentials"),
        path('file/post/', file.file_post, name="web_file_post"),
        path('file/download/<int:file_id>/', file.file_download, name="web_file_download"),

        path('wiki/', wiki.wiki, name="web_wiki"),
        path('wiki/add', wiki.wiki_add, name="web_wiki_add"),
        path('wiki/edit/(?P<wiki_id>\d+)', wiki.wiki_edit, name="web_wiki_edit"),
        path('wiki/catalog', wiki.wiki_catalog, name="web_wiki_catalog"),
        path('wiki/delete/(?P<wiki_id>\d+)', wiki.wiki_delete, name="web_wiki_delete"),
        path('wiki/upload', wiki.wiki_upload, name="web_wiki_upload"),

        path('setting/', settings.setting, name="web_setting"),
        path('setting/delete/', settings.delete, name="web_setting_delete"),

        path('issues/', issues.issues, name="web_issues"),
        path('issues/detail/<int:issues_id>/', issues.issues_detail, name="web_issues_detail"),
        path('issues/record/<int:issues_id>/', issues.issues_record, name="web_issues_record"),
        path('issues/change/<int:issues_id>/', issues.issues_change, name="web_issues_change"),
        path('issues/invite/url/', issues.invite_url, name="web_invite_url"),


    ], None)),
    path('issues/invite/join/<str:code>/', issues.invite_join, name="invite_join"),

]
